/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Renato
 */
@Entity
@Table(name = "asignacion_alumno", catalog = "inscripciones", schema = "")
@NamedQueries({
    @NamedQuery(name = "AsignacionAlumno.findAll", query = "SELECT a FROM AsignacionAlumno a"),
    @NamedQuery(name = "AsignacionAlumno.findByIdPeriodo", query = "SELECT a FROM AsignacionAlumno a WHERE a.asignacionAlumnoPK.idPeriodo = :idPeriodo"),
    @NamedQuery(name = "AsignacionAlumno.findByIdCurso", query = "SELECT a FROM AsignacionAlumno a WHERE a.asignacionAlumnoPK.idCurso = :idCurso"),
    @NamedQuery(name = "AsignacionAlumno.findByIdAlumno", query = "SELECT a FROM AsignacionAlumno a WHERE a.asignacionAlumnoPK.idAlumno = :idAlumno"),
    @NamedQuery(name = "AsignacionAlumno.findByCalificacion", query = "SELECT a FROM AsignacionAlumno a WHERE a.calificacion = :calificacion"),
    @NamedQuery(name = "AsignacionAlumno.findByPago", query = "SELECT a FROM AsignacionAlumno a WHERE a.pago = :pago"),
    @NamedQuery(name = "AsignacionAlumno.findByPaqueteAlumno", query = "SELECT a FROM AsignacionAlumno a WHERE a.paqueteAlumno = :paqueteAlumno")})
public class AsignacionAlumno implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AsignacionAlumnoPK asignacionAlumnoPK;
    @Column(name = "calificacion", precision = 12)
    private Float calificacion;
    @Column(name = "pago", precision = 12)
    private Float pago;
    @Basic(optional = false)
    @Column(name = "paquete_alumno", nullable = false)
    private boolean paqueteAlumno;
    @JoinColumn(name = "id_periodo", referencedColumnName = "id_periodo", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Periodo periodo;
    @JoinColumn(name = "id_curso", referencedColumnName = "id_curso", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Curso curso;
    @JoinColumns({
        @JoinColumn(name = "id_periodo", referencedColumnName = "id_periodo", nullable = false, insertable = false, updatable = false),
        @JoinColumn(name = "id_curso", referencedColumnName = "id_curso", nullable = false, insertable = false, updatable = false)})
    @ManyToOne(optional = false)
    private AsignacionCurso asignacionCurso;
    @JoinColumn(name = "id_alumno", referencedColumnName = "id_alumno", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Alumno alumno;

    public AsignacionAlumno() {
    }

    public AsignacionAlumno(AsignacionAlumnoPK asignacionAlumnoPK) {
        this.asignacionAlumnoPK = asignacionAlumnoPK;
    }

    public AsignacionAlumno(AsignacionAlumnoPK asignacionAlumnoPK, boolean paqueteAlumno) {
        this.asignacionAlumnoPK = asignacionAlumnoPK;
        this.paqueteAlumno = paqueteAlumno;
    }

    public AsignacionAlumno(String idPeriodo, String idCurso, int idAlumno) {
        this.asignacionAlumnoPK = new AsignacionAlumnoPK(idPeriodo, idCurso, idAlumno);
    }

    public AsignacionAlumnoPK getAsignacionAlumnoPK() {
        return asignacionAlumnoPK;
    }

    public void setAsignacionAlumnoPK(AsignacionAlumnoPK asignacionAlumnoPK) {
        this.asignacionAlumnoPK = asignacionAlumnoPK;
    }

    public Float getCalificacion() {
        return calificacion;
    }

    public void setCalificacion(Float calificacion) {
        this.calificacion = calificacion;
    }

    public Float getPago() {
        return pago;
    }

    public void setPago(Float pago) {
        this.pago = pago;
    }

    public boolean getPaqueteAlumno() {
        return paqueteAlumno;
    }

    public void setPaqueteAlumno(boolean paqueteAlumno) {
        this.paqueteAlumno = paqueteAlumno;
    }

    public Periodo getPeriodo() {
        return periodo;
    }

    public void setPeriodo(Periodo periodo) {
        this.periodo = periodo;
    }

    public Curso getCurso() {
        return curso;
    }

    public void setCurso(Curso curso) {
        this.curso = curso;
    }

    public AsignacionCurso getAsignacionCurso() {
        return asignacionCurso;
    }

    public void setAsignacionCurso(AsignacionCurso asignacionCurso) {
        this.asignacionCurso = asignacionCurso;
    }

    public Alumno getAlumno() {
        return alumno;
    }

    public void setAlumno(Alumno alumno) {
        this.alumno = alumno;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (asignacionAlumnoPK != null ? asignacionAlumnoPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AsignacionAlumno)) {
            return false;
        }
        AsignacionAlumno other = (AsignacionAlumno) object;
        if ((this.asignacionAlumnoPK == null && other.asignacionAlumnoPK != null) || (this.asignacionAlumnoPK != null && !this.asignacionAlumnoPK.equals(other.asignacionAlumnoPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.AsignacionAlumno[asignacionAlumnoPK=" + asignacionAlumnoPK + "]";
    }

}
